<template>
  <div class="app-header-sticky" :class="{show:y>=120}">
    <!-- 为了吸顶头部的内容不遮住不惜顶的头部 -->
    <div class="container" v-show="y>=120">
      <h1 class="logo"><RouterLink to="/">提子商城</RouterLink></h1>
      <AppHeaderNav />
      <div class="right  ">
        <!-- <RouterLink to="/" >品牌</RouterLink>
        <RouterLink to="/" >专题</RouterLink> -->
        <AppHeaderCart />
      </div>
    </div>
  </div>
</template>

<script>
import AppHeaderNav from './app-header-nav.vue'
import AppHeaderCart from './app-header-cart.vue'
import { useWindowScroll } from '@vueuse/core'

export default {
    name:'AppHeaderSticky',
    components: { AppHeaderNav, AppHeaderCart },
    setup() {
        const {y} = useWindowScroll()
        return {y}
    }
}
</script>

<style scoped lang='less'>
.app-header-sticky {
  width: 100%;
  height: 120px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 999;
  background-color: #fff;
  border-bottom: 1px solid #e4e4e4;
  transform: translateY(-100%);
  opacity: 0;
  &.show {
    transition: all 0.3s linear;
    transform: none;
    opacity: 1;
  }
  .container {
    display: flex;
    align-items: center;
  }
  .logo {
    width: 200px;
    a {
      display: block;
      height: 132px;
      width: 100%;
      text-indent: -9999px;
      background: url(../assets/images/logo1.png) no-repeat center 18px / contain;
    }
  }
  .right {
    width: 220px;
    text-align: center;
    padding-left: 170px;
    border-left: 2px solid @tiziColor;
  }
}
</style>